<form action="{$smarty.server.REQUEST_URI}" method="post" class="uniForm" enctype="multipart/form-data">
	
	{if $smarty.post}
		<div id="errorMsg">{$config.body_error}</div>
	{else}
		<div id="introMsg">{$config.body_intro}</div>
	{/if}
	
	<fieldset class="inlineLabels">
	
	{foreach from="`$config.fields`" item="field"}
		<div class="ctrlHolder {if $field._error}error{/if}">
			{if $field._error}<p class="errorField">{$field.error_text|escape:"html":"UTF-8"}</p>{/if}
			
			<label for="{$field.name|escape:"html":"UTF-8"}">{$field.label}</label>
			
			{if $field.type == 'text'}
				
				<input type="text" name="contact[{$field.name|escape:"html":"UTF-8"}]" value="{$field.current_value|escape:"html":"UTF-8"}" id="{$field.name|escape:"html":"UTF-8"}" class="{$field.type} textInput" />
				
			{elseif $field.type == 'info'}
				
				<span class="info">{$field.current_value}</span>
				<input type="hidden" name="contact[{$field.name|escape:"html":"UTF-8"}]" value="{$field.current_value|escape:"html":"UTF-8"}" id="{$field.name|escape:"html":"UTF-8"}" />
				
			{elseif $field.type == 'select'}
				
				<select name="contact[{$field.name|escape:"html":"UTF-8"}]" id ="{$field.name|escape:"html":"UTF-8"}" class="{$field.type}">
					<option></option>
					{foreach from="`$field.values`" key="value" item="label"}
						<option value="{$value|escape:"html":"UTF-8"}" {if $field.current_value == $value}selected="selected"{/if}>{$label|escape:"html":"UTF-8"}</option>
					{/foreach}
				</select>
				
			{elseif $field.type == 'radio'}
				
				<div class="multiField {$field.type}">
					{foreach from="`$field.values`" key="value" item="label" name="values"}
						<label class="inlineLabel" for="{$field.name|escape:"html":"UTF-8"}_{$smarty.foreach.values.index}"><input type="radio" name="contact[{$field.name|escape:"html":"UTF-8"}]" id ="{$field.name|escape:"html":"UTF-8"}_{$smarty.foreach.values.index}"  value="{$value|escape:"html":"UTF-8"}" {if $field.current_value == $value}checked="checked"{/if}> {$label|escape:"html":"UTF-8"}</label>
					{/foreach}
				</div>
				
			{elseif $field.type == 'checkbox'}
				
				<div class="multiField {$field.type}">
					{foreach from="`$field.values`" key="value" item="label" name="values"}
						<label class="inlineLabel" for="{$field.name|escape:"html":"UTF-8"}_{$smarty.foreach.values.index}"><input type="checkbox" name="contact[{$field.name|escape:"html":"UTF-8"}][]" id ="{$field.name|escape:"html":"UTF-8"}_{$smarty.foreach.values.index}" value="{$value|escape:"html":"UTF-8"}" {if in_array($value, $field.current_value)}checked="checked"{/if}> {$label|escape:"html":"UTF-8"}</label>
					{/foreach}
				</div>
				
			{elseif $field.type == 'date'}
				
				<input type="text" readonly="readonly" name="contact[{$field.name|escape:"html":"UTF-8"}]" value="{$field.current_value|escape:"html":"UTF-8"}" id="{$field.name|escape:"html":"UTF-8"}" class="{$field.type} textInput dateformat-{if $field.datepicker_format}{$field.datepicker_format}{else}dateformat-d-sl-m-sl-Y{/if} {$field.datepicker_classes} {if $field.range_low}range-low-{$field.range_low|strtotime|date:'Ymd'}{/if} {if $field.range_high}range-high{$field.range_high|strtotime|date:'Ymd'}{/if}" />
				
			{elseif $field.type == 'textarea'}
				
				<textarea name="contact[{$field.name|escape:"html":"UTF-8"}]" id="{$field.name|escape:"html":"UTF-8"}" class="{$field.type}">{$field.current_value|escape:"html":"UTF-8"}</textarea>
				
			{elseif $field.type == 'file'}
				
				<input type="file" name="contact[{$field.name|escape:"html":"UTF-8"}]" id="{$field.name|escape:"html":"UTF-8"}" {if $field.max_size}maxlength="{$field.max_size}"{/if} class="{$field.type}" />
				
			{/if}
			
			{if $field.hint_text}<p class="formHint">{$field.hint_text}</p>{/if}
			
		</div>
	{/foreach}
	
	{if $config.captcha == 'mathcaptcha'}
		<div class="ctrlHolder mathcaptcha {if $smarty.post and $mathcaptcha_error}error{/if}">
			{if $smarty.post and $mathcaptcha_error}<p class="errorField">{$config.mathcaptcha_error|escape:"html":"UTF-8"}</p>{/if}
			<p class="formHint">{$config.mathcaptcha_intro}</p>
			<label for="mathcaptcha"><img src="?mathcaptcha-img" />{*{$config.mathcaptcha_whatis|replace:'__sum__':"`$smarty.session.mathcaptcha.num1` + `$smarty.session.mathcaptcha.num2`"}*}</label>
			<input type="text" name="mathcaptcha" autocomplete="off" value="{$smarty.request.mathcaptcha}" id="mathcaptcha" class="mathcaptcha textInput" />
		</div>
	{/if}
	
	</fieldset>
	
	<div class="buttonHolder">
		<button type="submit" class="primaryAction">{$config.submit_button_text}</button>
	</div>
	
</form>
